<include file="public:header" />
<!--菜单添加-->
<style>
    .panel-body{line-height: 25px;}
    .panel-body span{
        margin-right: 5px;
        font-size: 12px;
        cursor: pointer;
        margin-top: 3px;
    }
</style>
<ul id="mytab" class="nav nav-tabs" style="margin-top: 15px;">
    <li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>
    <li class="active"><a href="#con1" data-toggle="tab">敏感词</a></li>
    <!--<li><a href="#con2" data-toggle="tab">菜单添加1</a></li>-->
</ul>
<div id="tabContent" class="tab-content">
    <div class="tab-pane fade in active" id="con1">
        <div style="margin-top: 20px;">
            <form class="form-horizontal" role="form" action="{:u('superadmin/settings/unabledwords')}" method="post">

                <div class="form-group">
                    <label class="col-sm-1 control-label label-form">敏感词:</label>
                    <div class="col-sm-3 input-padding">
                        <input type="text" class="form-control" name="words" id="words"
                               placeholder="请输入敏感词">
                    </div>
                    <button id="save" class="btn btn-primary">提交</button>
                </div>

                <div class="form-group">
                    <div class="panel panel-info" style="width: 97%; margin-top: 20px; margin-left: 30px;">

                        <div class="panel-body">
                            <notempty name="list">
                            <volist name="list" id="vo">
                              <span class="del_words label {$class_list[rand(0,5)]}" data-id="{$vo.id}" title="点击删除">{$vo.words}</span>
                            </volist>
                            </notempty>
                        </div>
                    </div>
                </div>

            </form>

        </div>
    </div>
    <!--<div class="tab-pane fade" id="con2">-->
    <!--code-->
    <!--</div>-->
</div>


<include file="public:footer" />
<script>
    $(document).ready(function(){
        $('#mytab a').click(function (e) {
            e.preventDefault()
            $(this).tab('show')
        })

        $('#save').click(function(){
            //数据验证
            $.ajax({
                type: "POST",
                url: $('.form-horizontal').attr('action'),
                data: $('.form-horizontal').serialize(),
                dataType: "json",
                success:function(data){
                    if(data.status)
                    {
                        layer.msg(data.msg,{icon: 1,time:2000, shade: [0.1, '#ccc']},function(){
                            window.location.reload();
                        });
                    } else {
                        layer.msg(data.msg,{icon: 2,time:2000, shade: [0.1, '#ccc']})
                    }
                }
            });
            return false;
        });

        $('.del_words').on('click',function(){
            var id  = $(this).attr('data-id');
            var url = "{:U('superadmin/settings/del_words')}";
            layer.confirm('确定删除？', function(){
                      $.post(url,{id:id},function(res){
                    if(res.status)
                    {
                        layer.msg(res.msg,{icon:1, time:2000}, function(){
                           window.location.reload();
                        })

                    }
                },'json')
            });
        })


    });
</script>
</body>
</html>